
#-------------------------------------------------------------------------------
# Configure variable
#-------------------------------------------------------------------------------
TOP_DIR:=${TOP_DIR}
MAKEFILE_PATH :=$(subst $(strip \),/,$(abspath $(lastword $(MAKEFILE_LIST))))

include ..\make.settings
include ..\dflags.settings

#-------------------------------------------------------------------------------
# Configure source code files
#-------------------------------------------------------------------------------
SRC_FILES+= \
   utils\json_token.c \
   utils\json_parser.c \
   utils\qcloud_iot_ca.c \
   utils\qcloud_iot_device.c \
   utils\qcloud_iot_log.c \
   utils\string_utils.c \
   utils\utils_aes.c \
   utils\utils_base64.c \
   utils\utils_getopt.c \
   utils\utils_hmac.c \
   utils\utils_list.c \
   utils\utils_md5.c \
   utils\utils_ringbuff.c \
   utils\utils_sha1.c \
   utils\utils_timer.c \
   network\network_interface.c \
   network\socket\network_socket.c \
   protocol\http\utils_httpc.c \
   protocol\http\utils_url_download.c \

ifneq (y,$(strip $(FEATURE_AUTH_WITH_NOTLS)))
   SRC_FILES+= \
     network\tls\network_tls.c

endif

ifeq (y,$(strip $(FEATURE_MQTT_COMM_ENABLED)))
   SRC_FILES+= \
      protocol\mqtt\mqtt_client.c \
      protocol\mqtt\mqtt_client_common.c \
      protocol\mqtt\mqtt_client_connect.c \
      protocol\mqtt\mqtt_client_net.c \
      protocol\mqtt\mqtt_client_publish.c \
      protocol\mqtt\mqtt_client_subscribe.c \
      protocol\mqtt\mqtt_client_unsubscribe.c \
      protocol\mqtt\mqtt_client_yield.c \
      
endif

ifeq (y,$(strip $(FEATURE_MQTT_COMM_ENABLED)))
   SRC_FILES+= \
      services\data_template\data_template_action.c \
      services\data_template\data_template_client.c \
      services\data_template\data_template_client_common.c \
      services\data_template\data_template_client_json.c \
      services\data_template\data_template_client_manager.c \
      services\data_template\data_template_event.c \

endif


ifeq (y,$(strip $(FEATURE_SYSTEM_COMM_ENABLED)))
   SRC_FILES+= \
      services\system\system_mqtt.c \

endif

ifeq (y,$(strip $(FEATURE_LOG_UPLOAD_ENABLED)))
   SRC_FILES+= \
      services\log\log_mqtt.c \
      services\log\log_upload.c \

endif

ifeq (y,$(strip $(FEATURE_DEV_DYN_REG_ENABLED)))
   SRC_FILES+= \
      services\dynreg\dynreg.c \
    
endif

ifeq (y,$(strip $(FEATURE_OTA_COMM_ENABLED)))
   SRC_FILES+= \
      services\ota\ota_client.c \
      services\ota\ota_fetch.c \
      services\ota\ota_lib.c \
      services\ota\ota_mqtt.c \

endif

ifeq (y,$(strip $(FEATURE_AT_TCP_ENABLED)))
   SRC_FILES+= \
      network\at_socket\at_client.c \
      network\at_socket\at_socket_inf.c \
      network\at_socket\at_utils.c \
      network\at_socket\network_at_tcp.c \

endif

ifeq (y,$(strip $(FEATURE_GATEWAY_ENABLED)))
   SRC_FILES+= \
   services\gateway\gateway_api.c \
   services\gateway\gateway_common.c \

endif

EXCLUDE_SRC_FILES := \

ifneq (y,$(strip $(FEATURE_OTA_COMM_ENABLED)))
   EXCLUDE_SRC_FILES += $(TOP_DIR)/$(SRC_DIR)/services/ota/ota_mqtt.c
   SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(SRC_FILES))
endif

ifneq (y,$(strip $(FEATURE_ACTION_ENABLED)))
   EXCLUDE_SRC_FILES += $(TOP_DIR)/$(SRC_DIR)/services/data_template/data_template_action.c
   SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(SRC_FILES))
endif

ifneq (y,$(strip $(FEATURE_EVENT_POST_ENABLED)))
   EXCLUDE_SRC_FILES += $(TOP_DIR)/$(SRC_DIR)/services/data_template/data_template_event.c
   SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(SRC_FILES))
endif



#-------------------------------------------------------------------------------
# the include directories
#-------------------------------------------------------------------------------
INC_DIRS+= \
  -I${TOP_DIR}/ \
  -I${TOP_DIR}/common/include \
  -I${TOP_DIR}/interface/third_party/qcloud-iot/include \
  -I${TOP_DIR}/interface/third_party/qcloud-iot/include/exports \
  -I${TOP_DIR}/interface/third_party/qcloud-iot/sdk_src/internal_inc

#-------------------------------------------------------------------------------
# Configure compile flag for C
#-------------------------------------------------------------------------------
U_FLAGS+= \

#-------------------------------------------------------------------------------
# Configure compile flag for C++
#-------------------------------------------------------------------------------
U_CPPFLAGS+=

#-------------------------------------------------------------------------------
# Configure default macro define
#-------------------------------------------------------------------------------
DFLAGS+= \
  -D__TM_ZONE=tm_zone \
  -D__TM_GMTOFF=tm_gmtoff 

#-------------------------------------------------------------------------------
# Configure link library
#-------------------------------------------------------------------------------
U_LIBS:=

#-------------------------------------------------------------------------------
# include mk file
#-------------------------------------------------------------------------------
include ${TOP_DIR}\config\common\makefile.mk
